package greed;

import java.util.Arrays;

/**
 * @Classname : AssignCookies
 * @Description : 455. 分发饼干
 * https://leetcode.cn/problems/assign-cookies/
 * @Author : chentianyu
 * @Date 2023/2/24 00:03
 */


public class AssignCookies {
    public int findContentChildren(int[] g, int[] s) {
        Arrays.sort(g);
        Arrays.sort(s);
        int gi = 0, si = 0;
        while (gi<g.length && si<s.length) {
            if (g[gi] <= s[si]) gi++;
            si++;
        }
        return gi;
    }
}
